import request from "@/api/request";
import type { AxiosResponse } from "axios";

// get list
export type GetClassifyParams = {
  channel: number | string,
  class_state: number | string
}
export function getClassify(params: GetClassifyParams): Promise<AxiosResponse> {
  return request('minigame/query_game_classes', params, 'post')
}


// create
type CreateParams = {
  channel: number,
  cn_name: string,
  en_name:string,
  pt_name: string,
  class_order: string,
  class_state: string,
  class_icon: File,
} | FormData
export function create(params: CreateParams):Promise<AxiosResponse>{
  return request('minigame/create_game_class', params, 'post')
}

// update
type UpdateParams = {
  channel: number,
  cn_name: string,
  en_name:string,
  pt_name: string,
  class_order: string,
  class_state: string,
  class_icon: File,
  class_id: number
} | FormData
export function update(params:UpdateParams):Promise<AxiosResponse>{
  return request('minigame/update_game_class', params, 'post')
}

// delete
type DeleteParams = {
  class_id: number
}
export function deleteApi(params: DeleteParams):Promise<AxiosResponse>{
  return request('minigame/delete_game_classes', params, 'post')
}